package com.night.xjh.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.night.common.entity.xjh.Callback;
import com.night.xjh.mapper.CallbackMapper;
import com.night.xjh.mapper.CallbackTypeMapper;
import com.night.xjh.service.CallbackService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName: CallbackServiceImpl
 * @Description: //TODO
 * @author: xjh
 * @date: 2022/10/21-15:14
 * @version: v1.0
 */
@Service
public class CallbackServiceImpl implements CallbackService {
    @Resource
    private CallbackMapper callbackMapper;
    public void add(Callback callback) {
        callbackMapper.add(callback);
    }

    public void delete(int id) {
        callbackMapper.deleteById(id);
    }

    public void update(Callback callback) {
        callbackMapper.update(callback);
    }

    public PageInfo<Callback> getAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Callback> list=callbackMapper.getAll();
        return new PageInfo<>(list);
    }

    public Callback getById(int id) {
        return callbackMapper.getById(id);
    }

    public PageInfo<Callback> getByCondition(Callback callback, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Callback> list=callbackMapper.getByCondition(callback);
        return new PageInfo<>(list);
    }
}
